namespace MyBlog.Model
{
    using System;
    using System.Collections.Generic;
    using System.ComponentModel.DataAnnotations;
    using System.ComponentModel.DataAnnotations.Schema;

    [Serializable]
    public partial class MsgReplyModel
    {
        public MsgReplyModel()
        {
            MsgReplyModels = new List<MsgReplyModel>();
        }
        public int ID { get; set; }

        public int MsgId { get; set; }

        [Required]
        public string Content { get; set; }

        public DateTime ReplyTime { get; set; }

        public  MessageModel Message { get; set; }

        public int? ParentID { set; get; }

        public string ReplyUid { set; get; }

        public MsgReplyModel Parent { set; get; }

        public List<MsgReplyModel> MsgReplyModels { set; get; }

        public bool IsLoop { set; get; }

        public string AgreeUsers { get; set; }

        public int AgreeCount
        {
            get
            {
                if (!string.IsNullOrWhiteSpace(AgreeUsers))
                {
                    if (AgreeUsers.Contains("&"))
                    {
                        return AgreeUsers.Split(new char[] { '&' }, StringSplitOptions.RemoveEmptyEntries).Length;
                    }
                    return 1;
                }
                return 0;
            }
        }
    }
}
